﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ihm;

namespace TestIHM
{
    class Program
    {
        static void Main(string[] args)
        {
            ClientSocket c = new ClientSocket();
            c.Connected += new ClientSocket.ConnectedHandler(c_Connected);
            c.DataArrival += new ClientSocket.DataArrivalHandler(c_DataArrival);
            Console.Write("Entrez votre ip: ");
            string ip = Console.ReadLine();
            Console.Write("Entrez votre Port: ");
            string port = Console.ReadLine();
            c.Connect(ip, port);
            while (true)
            {
                Console.Write("Entrez votre message: ");
                string message = Console.ReadLine();
                c.SendMsg(message);
            }
        }

        static void c_Connected(object sender, ClientSocket.NetworkEventArgs e)
        {
            Console.Out.WriteLine("\nConnecté");
        }

        static void c_DataArrival(object sender, ClientSocket.NetworkEventArgs e)
        {
            Console.Out.WriteLine("\nMessage reçu: " + e.Data);
        }

    }
}
